#ifndef TC_NULL_HH
#define TC_NULL_HH

/** \file Null.hh 
 * The declarations or definitions of various nulls.
 *
 * (C) Copyright  Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: Null.hh 119 2006-06-21 04:57:25Z semihc $
 *
 *
 */

#include <string>
#include "Global.hh"


//! Emulate wchar_t if not defined by C++
#ifdef TC_NO_WCHAR_T
 namespace std {
  typedef char wchar_t;
 }
#endif

//! Emulate wstring if not defined by C++
#ifdef TC_NO_WSTRING
 namespace std {
  typedef basic_string<wchar_t> wstring;
 }
#endif



namespace TC {

  //! Global declaration for null string: ""
  extern const char * const NullStr;

  //! Global declaration for null string in wide chars: L""
  extern const wchar_t * const NullWStr;

  //! Global declaration for null std::string: ""
  extern const std::string NullString;

  //! Global declaration for null std::wstring: L""
  extern const std::wstring NullWString;


  /**
   * Global definition of the null pointer. 
   * For information see item 25 of Effective C++ and
   * May 2004 article of Herb Sutter "Much ado about nothing".
   */
  const                      // This is a const object,
  class NullPtr_t {          // of type NullPtr_t class,
  public:

    operator void*() const   // This is to avoid defects in
    { return 0; }            // non-conformant compilers

    template <typename T>    // convertible to any type
    operator T*() const      // of null non-member
    { return 0; }            // pointer...

    template <typename C, typename T>   // or convertible to any type
    operator T C::*() const             // of null member pointer...
    { return 0; }

  private:
    
    void operator&() const;  // whose address cannot be taken
    
  } NullPtr = {};            // and whose name is NullPtr


  /** 
   * Used as a placeholder for "no type here".
   * Useful as an end marker in typelists.
   */
  class NullType {};
    


} // end namespace


#endif /* TC_NULL_HH */
